package com.mapper;

import com.bean.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Yuicon on 2017/3/23.
 */
@Repository
public interface CommentMapper {

    @Select("select * from tb_comment where article_id = #{articleId}")
    List<Comment> findByArticleId(String articleId);

    @Insert("insert into tb_comment(id,content,createTime,user_id,article_id)" +
            "values(#{id},#{content},#{createTime},#{userId},#{articleId})")
    int insert(Comment comment);
}
